package com.huike.web.controller.report;


import com.huike.report.domain.vo.IndexTodayInfoVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import com.huike.common.core.domain.AjaxResult;
import com.huike.report.service.IReportService;

import java.util.concurrent.ExecutionException;

@RestController
@RequestMapping("/index")
public class IndexController {

    @Autowired
    private IReportService reportService;


    /**
     * 首页--基础数据统计
     * @param beginCreateTime
     * @param endCreateTime
     * @return
     */
    @GetMapping("/getBaseInfo")
    public AjaxResult getBaseInfo(@RequestParam("beginCreateTime") String beginCreateTime,
                                  @RequestParam("endCreateTime") String endCreateTime){
        return AjaxResult.success(reportService.getBaseInfo(beginCreateTime,endCreateTime));
    }

    /**
     * 首页--今日简报统计
     * @return
     */
    @GetMapping("/getTodayInfo")
    public AjaxResult getTodayInfo() throws ExecutionException, InterruptedException {
        return AjaxResult.success(reportService.getTodayInfo());
    }

    /**
     * 首页--待办数据统计
     * @param beginCreateTime
     * @param endCreateTime
     * @return
     */
    @GetMapping("/getTodoInfo")
    public AjaxResult getTodoInfo(@RequestParam("beginCreateTime") String beginCreateTime,
                                  @RequestParam("endCreateTime") String endCreateTime) throws ExecutionException, InterruptedException {
        return AjaxResult.success(reportService.getTodoInfo(beginCreateTime,endCreateTime));
    }

    /**
     * 首页数据--商机转化龙虎榜
     * @param beginCreateTime
     * @param endCreateTime
     * @return
     */
    @GetMapping("/businessChangeStatistics")
    public AjaxResult getBusinessChangeStatistics(@RequestParam("beginCreateTime") String beginCreateTime,
                                  @RequestParam("endCreateTime") String endCreateTime) {
        return AjaxResult.success(reportService.getBusinessChangeStatistics(beginCreateTime,endCreateTime));
    }

    /**
     * 首页数据--线索转化龙虎榜
     * @param beginCreateTime
     * @param endCreateTime
     * @return
     */
    @GetMapping("/salesStatistic")
    public AjaxResult getSalesStatistic(@RequestParam("beginCreateTime") String beginCreateTime,
                                                  @RequestParam("endCreateTime") String endCreateTime) {
        return AjaxResult.success(reportService.getSalesStatistic(beginCreateTime,endCreateTime));
    }
}